package com.lcz.authority.admin.controller.system;

import com.lcz.authority.common.annotation.ApiResource;
import com.lcz.authority.common.domain.R;
import com.lcz.authority.common.enums.AppCodeEnum;
import com.lcz.authority.common.enums.ResBizTypeEnum;
import com.lcz.authority.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author lcz
 * @desc 首页
 * @mail lcz_0130@163.com
 * @date 2024/05/17
 */
@RestController
@ApiResource(name = "首页", resBizType = ResBizTypeEnum.SYSTEM, appCode = AppCodeEnum.SYSTEMMODULES)
@Api(tags = "首页")
public class SysIndexController {

    @Value("${lcz.version}")
    private String version;


    @RequestMapping("/")
    @ApiOperation("访问首页，提示语")
    public String index() {
        return StringUtils.format("欢迎使用lcz后台管理框架，当前版本：v{}，请通过前端地址访问。", version);
    }

    @GetMapping("/version")
    @ApiOperation("获取版本信息")
    public R version() {
        HashMap<String, String> map = new HashMap<>();
        map.put("version", version);
        return R.ok(map);
    }
}
